<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:import href="../config.xsl"/>
	<xsl:import href="../mdp.xsl"/>
	<xsl:template match="/">
		<msc type="form">
			<head>
				<title>收文</title>
			</head>
			<body>
				<!--标题-->
				<span width="100%" align="center">
					<strong>
						<font color="#FF0000">
							<xsl:value-of select="//table[@class='input_table']/tbody/tr[1]/td/span/text()"/>
						</font>
					</strong>
				</span>
				<hr/>
				<!--主体内容展现-->
				<span width='100%'>
					<xsl:apply-templates select="//table[@class='input_warp']"/>
					<xsl:apply-templates select="//form/div[@style='display:none']//input" mode="none"/>
					<xsl:apply-templates select="//form/div[@style='display:none']//textarea" mode="none"/>
					<span visible="false">
						<xsl:apply-templates select="//form/div[@style='display:none']//select"/>
					</span>
					<!--缺少的隐藏参数-->
					<input value="GB2312" name="%%PostCharset" type="hidden"/>
					<xsl:variable name="before">
						<xsl:value-of select="substring-before((//input[@name='finish']/@onclick),&quot;&apos;, this&quot;)"/>
					</xsl:variable>
					<input value="{substring-after($before,&quot;(&apos;&quot;)}" name="__Click" type="hidden"/>
					<input value="{//input[contains(@name,'ModDate')]/@value}" name="%%ModDate" type="hidden"/>
				</span>
			</body>
			<foot>
				<item type="submit"  caption="发送"/>
				<item type="button" target="_blank" caption="流程记录" href="{$url}/dhccoasf/gwsetup.nsf/frm_showFlowRecord?openform&amp;docid={//input[@name='Sys_Keyid']/@value}&amp;dbname={//input[@name='DBPath']/@value}&amp;flowName={//input[@name='Sys_flowName']/@value}"/>
			</foot>
		</msc>
	</xsl:template>
	<xsl:template match="table">
		<xsl:choose>
			<xsl:when test=".././@style='display:none'">	
		</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="tr"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="tr">
		<xsl:apply-templates select="td"/>
	</xsl:template>
	<xsl:template match="td">
		<xsl:choose>
			<xsl:when test="position() mod 2 != 0">
				<span width='30%'>
					<strong>
						<xsl:value-of select="."/>
					</strong>
				</span>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
					<!--附件判断-->
					<xsl:when test="a">
						<fileset enableadd="false" enabledel="false" name="fjlist">
							<xsl:apply-templates select="a"/>
						</fileset>
					</xsl:when>
					<!--正文判断-->
					<xsl:when test="contains(b/font/text(),'word正文')">
						<fileset enableadd="false" enabledel="false">
							<fileitem caption="正文" filetype="doc" enabledel="false" href="?action=viewfileremote@mdp&amp;url={$url}/dhccoasf/mss1.nsf/0/{//input[@name='mssDocid']/@value}/$FILE/zhengwen.doc"/>
						</fileset>
					</xsl:when>
					<!--时间控件-->
					<xsl:when test="font/input/@onclick">
						<span width="70%">
							<date_time value="{font/input/@value}" name="{font/input/@name}"/>
						</span>
					</xsl:when>
					<xsl:when test="div[@style='display:none']">
						<span width="70%">
							<xsl:apply-templates select="div" mode="div"/>
						</span>
						<br/>
					</xsl:when>
					<xsl:otherwise>
						<span width="70%">
							<!--这里目前就没调到-->
							<xsl:apply-templates select="font/input | font/textarea | font/select"/>
						</span>
						<br/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="div" mode="div">
		<xsl:choose>
			<xsl:when test="textarea[@name='sw_opinionContent_new0'] and contains(//input[@name='Sys_WritersStatus']/@value,'办公室拟办')">
				<xsl:apply-templates select="textarea"/>
			</xsl:when>
			<xsl:when test="textarea[@name='sw_opinionContent_new1'] and contains(//input[@name='Sys_WritersStatus']/@value,'领导批示')">
				<xsl:apply-templates select="textarea"/>
			</xsl:when>
			<xsl:otherwise>
				<span visible="false">
					<xsl:apply-templates select="input | font/input | select | font/select | font/textarea | textarea | p/font/input"/>
				</span>
				<xsl:value-of select="../font/text() | ../p/font/text()"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--附件模版-->
	<xsl:template match="a">
		<fileitem caption="{text()}" filetype="{substring-after(text(),'.')}" enabledel="false" href="?action=viewfileremote@mdp&amp;url={$url}{@href}"/>
	</xsl:template>
	<!--隐藏参数-->
	<xsl:template match="input" mode="none">
		<xsl:choose>
			<xsl:when test="@type='button'"/>
			<xsl:otherwise>
				<input name="{@name}" value="{@value}" type="hidden"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="textarea" mode="none">
		<input name="{@name}" value="{text()}" type="hidden"/>
	</xsl:template>
</xsl:stylesheet>
